Repository navigation
wasm32 and wasm64: the default library for -mm=rc, none and own - #92
Merged
Merged
Conversation
scripts/build_wasm.bat (and build_wasm.sh for a Linux host) build lib/<wasm32|wasm64>/unknown/unknown/unknown/<release|debug>/<rc|none|own>/libTypeScriptDefaultLib.a: lib.ts and the OS layer src/lib.wasm.ts, archived with llvm-ar. These targets have no C library, so there are no C++ wrappers: tslang links a wasm program with --allow-undefined, and the C functions and the wrappers' functions are imports the host implements (the compiler repo's docs/how/wasm/test/host.mjs). lib.wasm.ts declares no C data (an undefined data symbol is never resolved): the time zone comes from the host. Its signatures match lib.ts's declarations exactly, as wasm-ld checks them (convertInteger takes a long, snprintf returns an int). No gc build: the collector is not built for wasm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The default library for
wasm32-unknown-unknownandwasm64-unknown-unknown, under-mm=rc,noneandown.scripts/build_wasm.bat(Windows) andscripts/build_wasm.sh(Linux) buildlib/<wasm32|wasm64>/unknown/unknown/unknown/<release|debug>/<rc|none|own>/libTypeScriptDefaultLib.a, fromlib.tsand the new OS layersrc/lib.wasm.ts, archived withllvm-ar.--allow-undefined, so the C functions and the wrappers' functions are imports fromenv. The host implements them; the compiler repo'sdocs/how/wasm/test/host.mjsis that host, for Node and browsers.lib.wasm.tsdeclares no C data, because an undefined data symbol is never resolved; the time zone comes from the host. Its signatures match the declarations inlib.tsexactly, because wasm-ld checks them (convertIntegertakes along,snprintfreturns anint).gcbuild: the collector is not built for wasm.Goes with the compiler PR (wasm-defaultlib), which reads this archive's borrow facts under
-mm=own.Tests
The compiler repo's
docs/how/wasm/test/run_tests.mjs --suite=defaultlibcompilestests/*.tsagainst the wasm archives and runs them under Node 26. On wasm32 and wasm64, in release and in debug, 181 pass under none and rc and 180 under own.fetch.ts: the host has no network// gc onlyand// linux only, and, under own,// not ownbuild_wasm.shon a Linux host. It was run from Git Bash against the Windows tslang.🤖 Generated with Claude Code